import requests
import random

from util.proxies import get_proxies

# proxies = get_proxies()
proxies = {
    'http': 'http://d4143676909:0atxcgei@116.208.207.244:19975/',
    'https': 'http://d4143676909:0atxcgei@116.208.207.244:19975/',
}
i = 1
while True:
    try:
        i += 1
        res = requests.get(f"http://httpbin.org/get?a={random.randint(1, 100)}", proxies=proxies)
        print(res.status_code)
        if i == 10:
            break
    except requests.exceptions.ProxyError as e:
        print('代理错误', e)

    except Exception as e:
        print('未知错误', e)
    else:
        print(res.json())
